package dao.impl;

import dao.UserDao;
import org.apache.ibatis.session.SqlSession;
import pojo.User;
import utils.MyBatisUtil;

import java.util.List;

public class UserDaoImpl implements UserDao {
    @Override
    public int addUser(User user) {
         SqlSession session = MyBatisUtil.getSession();
         int result = session.getMapper(UserDao.class).addUser(user);
         session.commit();
        return result;
    }

    @Override
    public List<User> findAll() {
        return MyBatisUtil.getSession().getMapper(UserDao.class).findAll();


    }
}
